<?php
/* @var $this ApplyController */
/* @var $model ApplicationList */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'application-list-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
    <?php echo $form->labelEx($model,'cca_id'); ?>
    <?php if($model->isNewRecord){ ?>
		
		<?php $this->widget('CAutoComplete', array(
        'model'=>$model,
        'attribute'=>'cca_id',
        'minChars'=>2,
        'max'=>200,
        'url'=>CController::createUrl('autocomplete/byCcaName'),
        'htmlOptions'=>array('size'=>'50'))); 
		?>
	<?php }else{ ?>
    <?php echo $model->cca->name; ?>
    <?php echo $form->hiddenField($model,'cca_id'); ?>
    <?php } ?>
		<?php echo $form->error($model,'cca_id'); ?>
	</div>


	<div class="row">
		# of Vacancy: 
		<?php echo $form->textField($model,'vacancy'); ?>
		<?php echo $form->error($model,'vacancy'); ?>
	</div>

    <div class="row">
    	Status:
        <?php echo $form->dropDownList($model, 'is_open', array(1 => "Open", 0 => "Closed")); ?>
	</div>
	<div class="row">
    	<?php echo $form->labelEx($model2,'role_level'); ?>
        <?php echo $form->checkBoxList($model2, 'role_level', CHtml::listData(Role::model()->findAll(), 'id', 'name'), array('template'=>'{label} {input}')); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->